#include <iostream>
#include <list>

using namespace std;
#include "list.h"

void test_list1()
{
	ly::list<int> lt;
	lt.push_back(1);
	lt.push_back(2);
	lt.push_back(3);
	lt.push_front(4);
	lt.push_front(5);
	lt.push_back(6);

	for (auto l : lt)
	{
		cout << l << " ";
	}
	cout << endl;

	lt.pop_back();
	lt.pop_back();
	lt.pop_back();
	lt.pop_front();


	for (auto l : lt)
	{
		cout << l << " ";
	}
	cout << endl;
}

void test_list2()
{
	ly::list<int> lt;
	lt.push_back(1);
	lt.push_back(2);
	lt.push_back(3);
	lt.push_front(4);
	lt.push_front(5);
	lt.push_back(6);

	for (auto l : lt)
	{
		cout << l << " ";
	}
	cout << endl;

	ly::list<int>::iterator it = lt.begin();
	while (*it != 3)
	{
		++it;
	}
	it = lt.insert(it, 30);
	for (auto l : lt)
	{
		cout << l << " ";
	}
	cout << endl;
	lt.erase(it);
	for (auto l : lt)
	{
		cout << l << " ";
	}
	cout << endl;

	lt.clear();
	for (auto l : lt)
	{
		cout << l << " ";
	}
	cout << endl;
}

int main()
{
	test_list2();

	return 0;
}